﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit</title>
    <link href="~/Content/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Content/lib/layui/layui.js"></script>
</head>
<body>
    <form id="fUpdate" class="layui-form" action="">
        <input type="hidden" name="id" value="@ViewBag.A.id" />@*修改中不能缺少id*@

        <div class="layui-form-item">
            <label class="layui-form-label">商品分类名称</label>
            <div class="layui-input-inline">
                <input type="text" name="TypeName" value="@ViewBag.A.TypeName" required lay-verify="required" placeholder="商品分类名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

        <script>
            //Demo
            layui.use(['form', 'laydate'], function () {
                var form = layui.form;
                var $ = layui.$;
                var laydate = layui.laydate;

                //日期
                laydate.render({
                    elem: '#time'
                });
                laydate.render({
                    elem: '#update'
                });

                //监听提交
                form.on('submit(formDemo)', function (data) {
                    var fUpdate = $("#fUpdate").serialize();
                    $.post("/Back/Category/DealEdit", fUpdate, function (res) {
                        if (res.suc) {
                            layer.alert(res.msg);
                            //当你在iframe页面关闭自身时
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        } else {
                            layer.alert(res.msg);
                            window.parent.location.reload();
                        }
                    }, "json")
                    return false;
                });
            });
        </script>
</body>
</html>
